﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UmlControlLibrary;

namespace UmlControlLibrary
{
    /// <summary>
    /// Interaction logic for UmlTree.xaml
    /// </summary>
    public partial class UmlTree : UserControl
    {
        public bool CanDrag
        {
            get { return RootTreeView.CanDrag; }
            set { RootTreeView.CanDrag = value; }
        }

        public UmlTree()
        {
            InitializeComponent();
        }

        public override string ToString()
        {
            if (RootTreeView.Tree.SelectedItem != null)
            {
                string s = "";
                TreeViewItem node = RootTreeView.Tree.SelectedItem as TreeViewItem;
                s = (node.Header as UmlElement).Name;
                while (node.Parent is TreeViewItem)
                {
                    node = node.Parent as TreeViewItem;
                    s = (node.Header as UmlElement).Name + "." + s;
                }
                return s;//((UmlElement)(RootTreeView.Tree.SelectedItem as TreeViewItem).Header).Name;
            }
            else
                return base.ToString();
        }
    }
}
